package io;

import java.io.BufferedReader;
import java.io.FileReader;

/**
 * Created by Robo on 2018/2/24.
 */
public class TryWithResource {

    public static void main(String[] args) {
//        long[] arr = {1, 2, 3};
//        new ForkJoinSumCalculator(arr);


        String fileName = "C:\\Users\\Roboful\\Desktop\\Resume4Print.md";
        System.out.println(loadFileContent(fileName));

    }

    private static String loadFileContent(String fileName) {
        try (
                FileReader fr = new FileReader(fileName);
                BufferedReader br = new BufferedReader(fr)
        ) {
            StringBuilder sb = new StringBuilder();
            String buf;
            while ((buf = br.readLine() )!= null) {
                sb.append(buf+"\n");
            }
            return sb.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return "error:{}" + e.getMessage();
        } finally {
            System.out.println("finally....");
        }
    }

}
